package com.example.testplatform.common;

/**
 * 系统常量类
 */
public class Constants {

    /**
     * 角色常量
     */
    public static class Role {
        public static final String ADMIN = "ADMIN";
        public static final String PRODUCT_MANAGER = "PRODUCT_MANAGER";
        public static final String TEST_MANAGER = "TEST_MANAGER";
        public static final String TESTER = "TESTER";
    }

    /**
     * 用户状态常量
     */
    public static class UserStatus {
        public static final Integer DISABLED = 0;
        public static final Integer ENABLED = 1;
    }

    /**
     * 产品状态常量
     */
    public static class ProductStatus {
        public static final Integer DISABLED = 0;
        public static final Integer ENABLED = 1;
    }

    /**
     * 测试申请单状态常量
     */
    public static class ApplicationStatus {
        public static final Integer DRAFT = 0;          // 待提交
        public static final Integer WAIT_PLATFORM_AUDIT = 1;  // 待平台审核
        public static final Integer WAIT_TEST_MANAGER_AUDIT = 2;  // 待测试负责人审批
        public static final Integer WAIT_TEST = 3;       // 待测试
        public static final Integer TESTING = 4;         // 测试中
        public static final Integer TEST_COMPLETED = 5;  // 测试完成
        public static final Integer REJECTED = 6;        // 已驳回
        public static final Integer CANCELED = 7;        // 已撤销
    }

    /**
     * 测试用例类型常量
     */
    public static class TestCaseType {
        public static final Integer MANUAL = 1;          // 手动测试
        public static final Integer UI_AUTOMATION = 2;   // UI自动化
        public static final Integer API_AUTOMATION = 3;  // 接口自动化
        public static final Integer PERFORMANCE = 4;     // 性能测试
    }

    /**
     * 测试用例状态常量
     */
    public static class TestCaseStatus {
        public static final Integer DRAFT = 0;           // 草稿
        public static final Integer ACTIVE = 1;          // 启用
        public static final Integer DISABLED = 2;        // 禁用
    }

    /**
     * 缺陷状态常量
     */
    public static class DefectStatus {
        public static final Integer SUBMITTED = 1;       // 已提交
        public static final Integer ASSIGNED = 2;        // 已指派
        public static final Integer IN_PROGRESS = 3;     // 处理中
        public static final Integer FIXED = 4;           // 已修复
        public static final Integer VERIFIED = 5;        // 已验证
        public static final Integer CLOSED = 6;          // 已关闭
        public static final Integer REJECTED = 7;        // 已拒绝
    }

    /**
     * 缺陷严重程度常量
     */
    public static class DefectSeverity {
        public static final Integer BLOCKER = 1;         // 阻断
        public static final Integer CRITICAL = 2;        // 严重
        public static final Integer MAJOR = 3;           // 主要
        public static final Integer MINOR = 4;           // 次要
        public static final Integer TRIVIAL = 5;         // 轻微
    }

    /**
     * JWT常量
     */
    public static class JWT {
        // 使用足够长度的Base64编码密钥（512位）
        public static final String SECRET_KEY = "1OBG8XHwyrbWNFOVd5naLOyA4YJVoh73/WnrlDuOPajmR5+hCGbHsoh6Kc0X7z806ExZ4+UqDOB17y0yYps9EA==";
        public static final Long EXPIRATION_TIME = 7 * 24 * 60 * 60 * 1000L;  // 过期时间（7天）
        public static final String TOKEN_HEADER = "Authorization";  // 请求头
        public static final String TOKEN_PREFIX = "Bearer ";  // 前缀
    }

    /**
     * 文件上传常量
     */
    public static class File {
        public static final String UPLOAD_DIR = "D:/trae/upload";  // 上传目录
        public static final Long MAX_FILE_SIZE = 100 * 1024 * 1024L;  // 最大文件大小（100MB）
        public static final String[] ALLOWED_EXTENSIONS = {"jpg", "jpeg", "png", "gif", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf", "zip", "rar"};  // 允许的文件扩展名
    }

}